Skip to content

Comments

lexerOf comments by file#26

Open
Palezehvat wants to merge 3 commits intomainfrom
lexerOfCommentsByFile
Open

lexerOf comments by file#26
Palezehvat wants to merge 3 commits intomainfrom
lexerOfCommentsByFile

Conversation

@Palezehvat
Copy link
Owner

No description provided.

#include "lexerOfComments.h"

int changeStage(int statusTable[5][2], int stage, int symbol) {
int posSymbol = symbol % 42 == 0 ? 0 : 1;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Отступы табуляциями вроде стайлгайдом запрещены

#include "lexerOfComments.h"

int changeStage(int statusTable[5][2], int stage, int symbol) {
int posSymbol = symbol % 42 == 0 ? 0 : 1;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А вообще, интересно, автомат умеет различать только два типа символов, тогда как по смыслу есть *, / и всё остальное, три категории

while (fscanf(file, "%c", &symbol) == 1) {
if (symbol == '/') {
switch (stage) {
case(1):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Скобки вокруг case-ов не нужны

indexBuffer = 0;
break;
}
stage = changeStage(statusTable, stage, (int)symbol);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это должно произойти в любом случае, поэтому должно быть вне if-а (вообще, if должен отвечать только за побочные эффекты автомата, изменением состояния он управлять не имеет права)

++indexBuffer;
} else {
clearBuffer(bufferWithOneComment, &indexBuffer);
stage = 1;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вот так, например, нельзя

typedef enum Error {
ok,
fileProblem
}Error;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}Error;
} Error;

Comment on lines 1 to 2
#pragma once
#include <stdio.h>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#pragma once
#include <stdio.h>
#pragma once
#include <stdio.h>

fileProblem
}Error;

char* lexerOfComments(const char* fileNameTable, const char* fileNameWithStrings, Error* errorCheck); No newline at end of file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Надо комментарии

#include <stdio.h>
#include <stdlib.h>
#include "test.h"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лишняя пустая строчка

#pragma once
#include <stdbool.h>

bool test(); No newline at end of file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

И тут надо комментарии

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants